package com.baseweb.webadmin.controller.web;

import com.baseweb.webadmin.controller.BaseController;
import com.baseweb.webadmin.core.util.CitiesUtil;
import com.baseweb.webadmin.core.util.IPSeeker;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by dengsy on 2017-06-22.
 */
@Controller
public class HtmlController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(com.baseweb.webadmin.controller.admin.LoginController.class);
    private final static String SESSION_CHECK_CODE = "checkCode";

    /**
     * 主页
     */
    @RequestMapping(value = "/")
    public String root(@RequestParam(value = "current_city", required = false) String current_city, HttpServletRequest request) {
        HttpSession session = request.getSession();

        String address = "";
        if (StringUtils.isBlank((String) session.getAttribute("current_city"))) {

            String ip = request.getRemoteAddr();

            try {
                address = IPSeeker.getAddress("ip=" + ip, "utf-8");
            } catch (Exception e) {
                address = "成都市";
                logger.info("获取IP地理位置失败", e.getMessage());
            }
        }else{
            if (StringUtils.isNotBlank(current_city)){
                address = current_city;
            }else{
                address = (String) session.getAttribute("current_city");
            }
        }

        session.setAttribute("current_city", address);
        List<String> areaList = new ArrayList<String>();
        if (StringUtils.isNotBlank(address)) {
            areaList = CitiesUtil.getAreasListByCityName(address);
        }
        session.setAttribute("area_list", areaList);

        return "main.html";
    }

    /**
     * 首页
     */
    @RequestMapping(value = "/indexHtml")
    public String indexHtml() {
        return "index.html";
    }

    /**
     * 登录页面
     */
    @RequestMapping(value = "/loginHtml")
    public String loginHtml() {
        return "login.html";
    }

    /**
     * 区域页面
     */
    @RequestMapping(value = "/addressHtml")
    public String addressHtml() {
        return "address.html";
    }

    /**
     * 会员注册页面
     */
    @RequestMapping(value = "/registerHtml")
    public String registerHtml() {
        return "register.html";
    }

    /**
     * 商家入驻资料完善页面
     */
    @RequestMapping(value = "/tenantsDetailHtml")
    public String tenantsDetailHtml() {
        return "tenantsDetail.html";
    }

    /**
     * 商家入驻页面
     */
    @RequestMapping(value = "/tenantsHtml")
    public String tenantsHtml() {
        return "tenants.html";
    }

    /**
     * 下载APP页面
     */
    @RequestMapping(value = "/uploadAppHtml")
    public String uploadAppHtml() {
        return "uploadApp.html";
    }

    /**
     * 我的购物车页面
     */
    @RequestMapping(value = "/cartHtml")
    public String cartHtml() {
        return "cart.html";
    }

    /**
     * 策划师页面
     */
    @RequestMapping(value = "/planner_ListHtml")
    public String planner_ListHtml() {
        return "planner_List.html";
    }

    /**
     * 主持人页面
     */
    @RequestMapping(value = "/compere_ListHtml")
    public String compere_ListHtml() {
        return "compere_List.html";
    }

    /**
     * 摄影师页面
     */
    @RequestMapping(value = "/photographer_ListHtml")
    public String photographer_ListHtml() {
        return "photographer_List.html";
    }

    /**
     * 摄像师页面
     */
    @RequestMapping(value = "/cameraman_ListHtml")
    public String cameraman_ListHtml() {
        return "cameraman_List.html";
    }

    /**
     * 化妆师页面
     */
    @RequestMapping(value = "/dresser_ListHtml")
    public String dresser_ListHtml() {
        return "dresser_List.html";
    }

    /**
     * 婚礼案例页面
     */
    @RequestMapping(value = "/case_ListHtml")
    public String case_ListHtml() {
        return "case_List.html";
    }

    /**
     * 婚礼案例详情页面
     */
    @RequestMapping(value = "/case_DetailsHtml")
    public String case_DetailsHtml() {
        return "case_Details.html";
    }

    /**
     * 关于我们页面
     */
    @RequestMapping(value = "/aboutHtml")
    public String aboutHtml() {
        return "about.html";
    }

    /**
     * 后台首页
     */
    @RequestMapping(value = "/systemMainHtml")
    public String systemMainHtml() {
        return "system/system_main.html";
    }

    /**
     * 后台主页
     */
    @RequestMapping(value = "/systemIndexHtml")
    public String systemIndexHtml() {
        return "system/system_index.html";
    }

    /**
     * 后台权限角色
     */
    @RequestMapping(value = "/systemDictionHtml")
    public String systemDictionHtml() {
        return "system/system_diction.html";
    }

    /**
     * 后台职业角色
     */
    @RequestMapping(value = "/systemOccupationHtml")
    public String systemOccupationHtml() {
        return "system/system_occupation.html";
    }

    /**
     * 后台佣金角色
     */
    @RequestMapping(value = "/systemCommissionHtml")
    public String systemCommissionHtml() {
        return "system/system_commission.html";
    }

    /**
     * 后台信誉角色
     */
    @RequestMapping(value = "/systemCredibilityHtml")
    public String systemCredibilityHtml() {
        return "system/system_credibility.html";
    }

    /**
     * 后台用户管理
     */
    @RequestMapping(value = "/systemUserControlHtml")
    public String systemUserControlHtml() {
        return "system/system_user_control.html";
    }

    /**
     * 后台修改密码
     */
    @RequestMapping(value = "/systemChangePassHtml")
    public String systemChangePassHtml() {
        return "system/system_changePass.html";
    }

    /**
     * 后台邀请管理
     */
    @RequestMapping(value = "/systemInviteGlHtml")
    public String systemInviteGlHtml() {
        return "system/system_inviteGl.html";
    }

    /**
     * 后台我的邀请
     */
    @RequestMapping(value = "/systemMineInviteHtml")
    public String systemMineInviteHtml() {
        return "system/system_mine_Invite.html";
    }


    /**
     * 后台推荐团队
     */
    @RequestMapping(value = "/systemRecomTeamHtml")
    public String systemRecomTeamHtml() {
        return "system/system_recomTeam.html";
    }

    /**
     * 后台黑名单库
     */
    @RequestMapping(value = "/systemBlacklistHtml")
    public String systemBlacklistHtml() {
        return "system/system_blacklist.html";
    }

    /**
     * 后台添加用户
     */
    @RequestMapping(value = "/systemAddUserHtml")
    public String systemAddUserHtml() {
        return "system/system_addUser.html";
    }

    /**
     * 后台编辑资料
     */
    @RequestMapping(value = "/systemEditDataHtml")
    public String systemEditDataHtml() {
        return "system/system_edit_Data.html";
    }

    /**
     * 后台日志管理
     */
    @RequestMapping(value = "/systemJournalHtml")
    public String systemJournalHtml() {
        return "system/system_journal.html";
    }

    /**
     * 后台订单中心
     */
    @RequestMapping(value = "/systemOrderCenterHtml")
    public String systemOrderCenterHtml() {
        return "system/system_order_Center.html";
    }

    /**
     * 后台我的订单
     */
    @RequestMapping(value = "/systemMineOrderHtml")
    public String systemMineOrderHtml() {
        return "system/system_mine_Order.html";
    }

    /**
     * 后台商家接单
     */
    @RequestMapping(value = "/systemBusinessHtml")
    public String systemBusinessHtml() {
        return "system/system_business.html";
    }

    /**
     * 后台订单详情
     */
    @RequestMapping(value = "/systemOrderDetailsHtml")
    public String systemOrderDetailsHtml() {
        return "system/system_orderDetails.html";
    }

    /**
     * 后台我的档期
     */
    @RequestMapping(value = "/systemScheduleHtml")
    public String systemScheduleHtml() {
        return "system/system_schedule.html";
    }
    /**
     * @description：后台内容管理中的广告列表
     * @author: xiaoqiang
     * @time: 2017/7/8 12:21
     */
    @RequestMapping(value = "/htmlWeb/systemAdverListHtml")
    public String systemAdverListHtml() {
        return "system/system_adverList.html";
    }
    /**
     * @description：后台内容管理中的广告添加
     * @author: xiaoqiang
     * @time: 2017/7/8 12:21
     */
    @RequestMapping(value = "/htmlWeb/systemAddAdverHtml")
    public String systemAddAdverHtml() {
        return "system/system_addAdver.html";
    }
    /**
     * @description：后台内容管理中的广告栏目列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemAdverList1Html")
    public String systemAdverListHtml1() {
        return "system/system_adverList1.html";
    }

    /**
     * @description：后台内容管理中的栏目列表
     * @author: xiaoqiang
     * @time: 2017/7/8 12:21
     */
    @RequestMapping(value = "/htmlWeb/systemProgramaHtml")
    public String systemProgramaHtml() {
        return "system/system_programa.html";
    }
    /**
     * @description：后台内容管理中的栏目添加
     * @author: xiaoqiang
     * @time: 2017/7/8 12:21
     */
    @RequestMapping(value = "/htmlWeb/systemAddProgramaHtml")
    public String systemAddProgramaHtml() {
        return "system/system_programaNew.html";
    }

    /**
     * @description：报价列表
     * @author: zhouxin
     */
    @RequestMapping(value = "/htmlWeb/systemOfferListHtml")
    public String systemOfferListHtml() {
        return "system/system_offerList.html";
    }

    /**
     * @description：我的报价
     * @author: zhouxin
     */
    @RequestMapping(value = "/htmlWeb/systemMineOfferHtml")
    public String systemMineOfferHtml() {
        return "system/system_mine_offer.html";
    }
    /**
    * @description：后台内容管理中的公告列表
    * @author: xiaoqiang
    */
    @RequestMapping(value = "/htmlWeb/systemNoticeHtml")
    public String systemNoticeHtml() {
        return "system/system_notice.html";
    }
    /**
     * @description：后台内容管理中的公告新建
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemNoticeNewHtml")
    public String systemNoticeNewHtml() {
        return "system/system_noticeNew.html";
    }
    /**
     * @description：后台内容管理中的文章列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemArticleHtml")
    public String systemArticleHtml() {
        return "system/system_article.html";
    }
    /**
     * @description：后台内容管理中的文章新建
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemArticleNewHtml")
    public String systemArticleNewHtml() {
        return "system/system_articleNew.html";
    }
    /**
     * @description：后台内容管理中的用户反馈列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemFeedbackHtml")
    public String systemFeedbackHtml() {
        return "system/system_feedback.html";
    }
    /**
     * @description：后台内容管理中的关键字列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemKeywordHtml")
    public String systemKeywordHtml() {
        return "system/system_keyword.html";
    }
    /**
     * @description：后台内容管理中的关键字列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemKeywordNewHtml")
    public String systemKeywordNewHtml() {
        return "system/system_keywordNew.html";
    }


    /**
     * @description：支付界面
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/formPay")
    public String formPay() {
        return "system/formPay.html";
    }
    /**
     * @description：后台意向客户中的客户列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemIntentCustomerHtml")
    public String systemIntentCustomerHtml() {
        return "system/system_intentCustomer.html";
    }
    /**
     * @description：后台评论管理中的评价列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemEvaluationListHtml")
    public String systemEvaluationListHtml() {
        return "system/system_evaluationList.html";
    }
    /**
     * @description：后台评论管理中的我的评价列表
     * @author: xiaoqiang
     */
    @RequestMapping(value = "/htmlWeb/systemMinEvaluationHtml")
    public String systemMinEvaluationHtml() {
        return "system/system_minEvaluation.html";
    }

    /**
     * @description：作品列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemWorksListHtml")
    public String systemWorkListHtml() {
        return "system/system_worksList.html";
    }

    /**
     * @description：案例列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemCaseListHtml")
    public String systemCaseListHtml() {
        return "system/system_caseList.html";
    }

    /**
     * @description：新建案例
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemCaseAddHtml")
    public String systemCaseAddHtml() {
        return "system/system_caseAdd.html";
    }

    /**
     * @description：费用列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemCostListHtml")
    public String systemCostListHtml() {
        return "system/system_costList.html";
    }

    /**
     * @description：新增费用
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemCostAddHtml")
    public String systemCostAddHtml() {
        return "system/system_costAdd.html";
    }

    /**
     * @description：新增评论
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemDiscussAddHtml")
    public String systemDiscussAddHtml() {
        return "system/system_discussAdd.html";
    }
    /**
     * @description：评论列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemDiscussListHtml")
    public String systemDiscussListHtml() {
        return "system/system_discussList.html";
    }

    /**
     * @description：推荐列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemRecommendListHtml")
    public String systemRecommendListHtml() {
        return "system/system_recommendList.html";
    }

    /**
     * @description：新增推荐
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemRecommendAddHtml")
    public String systemRecommendAddHtml() {
        return "system/system_recommendAdd.html";
    }

    /**
     * @description：图片上传
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemPicUploadHtml")
    public String systemPicUploadHtml() {
        return "system/system_picUpload.html";
    }

    /**
     * @description：图片列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemPicListHtml")
    public String systemPicListHtml() {
        return "system/system_picList.html";
    }

    /**
     * @description：视频列表
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemVideoListHtml")
    public String systemVideoListHtml() {
        return "system/system_videoList.html";
    }

    /**
     * @description：视频上传
     * @author:
     */
    @RequestMapping(value = "/htmlWeb/systemVideoUploadHtml")
    public String systemVideoUploadHtml() {
        return "system/system_videoUpload.html";
    }

    /**
     * 文章详情
     */
    @RequestMapping(value = "/articleDetailsHtml")
    public String articleDetailsHtml() {
        return "article_Details.html";
    }

    /**
     * 提现账户
     */
    @RequestMapping(value = "/systemAccountCashHtml")
    public String accountCashHtml() {
        return "system/system_accountCash.html";
    }

    /**
     * 博币流水
     */
    @RequestMapping(value = "/systemCurrencyWaterHtml")
    public String currencyWaterHtml() {
        return "system/system_currencyWater.html";
    }

    /**
     * 提现管理
     */
    @RequestMapping(value = "/systemManageCashHtml")
    public String manageCashHtml() {
        return "system/system_manageCash.html";
    }

    /**
     * 我的代金券
     */
    @RequestMapping(value = "/systemMineCurrencyHtml")
    public String mineCurrencyHtml() {
        return "system/system_mine_currency.html";
    }

    /**
     * 钱包流水
     */
    @RequestMapping(value = "/systemPurseWaterHtml")
    public String purseWaterHtml() {
        return "system/system_purseWater.html";
    }

    /**
     * 代金券管理
     */
    @RequestMapping(value = "/systemVoucherHtml")
    public String voucherHtml() {
        return "system/system_voucher.html";
    }

    /**
     * 我要提现
     */
    @RequestMapping(value = "/systemWithdrawWantHtml")
    public String withdrawWantHtml() {
        return "system/system_withdrawWant.html";
    }

    /**
     * 服务城市
     */
    @RequestMapping(value = "/systemOpenCityHtml")
    public String systemOpenCityHtml() {
        return "system/system_open_city.html";
    }

    /**
     * 详细页面
     */
    @RequestMapping(value = "/articleDetails1Html")
    public String articleDetails1Html() {
        return "article_Details1.html";
    }
    /**
     * 认证审核页面
     */
    @RequestMapping(value = "/htmlWeb/systemCertiAuditHtml")
    public String systemCertiAuditHtml() {
        return "system/system_certiAudit.html";
    }

    /**
     * 我的审核
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemMineCertificaHtml")
    public String systemMineCertificaHtml() {
        return "system/system_mineCertifica.html";
    }

    /**
     * 用户申请审核
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemApplyCertiHtml")
    public String systemApplyCertiHtml() {
        return "system/system_applyCerti.html";
    }

    /**
     * 婚礼环境新增
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemWedEnvironmentAddHtml")
    public String systemWedEnvironmentAddHtml() {
        return "system/system_wedEnvironmentAdd.html";
    }

    /**
     * 婚礼环境
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemWedEnvironmentHtml")
    public String systemWedEnvironmentHtml() {
        return "system/system_wedEnvironment.html";
    }

    /**
     * 婚礼类型
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemWedTypeAddHtml")
    public String systemWedTypeAddHtml() {
        return "system/system_wedTypeAdd.html";
    }

    /**
     * 婚礼类型
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemWedTypeHtml")
    public String systemWedTypeHtml() {
        return "system/system_wedType.html";
    }

    /**
     * 广告审核管理
     * @return
     */
    @RequestMapping(value = "/htmlWeb/systemAdverAuditHtml")
    public String systemAdverAuditHtml() {
        return "system/system_adverAudit.html";
    }
    /**
     * 广告审核管理
     * @return
     */
    @RequestMapping(value = "/htmlWeb/advertsListHtml")
    public String advertsListHtml() {
        return "adverts_List.html";
    }

    /**
     * 请柬1
     * */
    @RequestMapping(value = "/invitation/invitationOneHtml")
    public String invitation1Html(@RequestParam("userInvitationId") String userInvitationId){
        return "invitation/invitation_one.html?userInvitationId="+userInvitationId;
    }
}
